#pragma once

#include <pthread.h>
#include <vector>
#include <queue>
#include "Thread.hpp"

namespace threadpool
{
    using namespace ThreadModule;
    class ThreadPool
    {
    public:
        ThreadPool(int num) : _num(num)
        {
            for (int i = 0; i < _num; i++)
            {
                _threads.emplace_back(Routine);
            }
        }
        void Routine()
        {
        }
        void Start()
        {
            for (auto &thread : _threads)
            {
                thread.Start();
            }
        }

    private:
        int _num;                     // 线程的数量
        std::queue<func_t> _q;        // 任务队列
        std::vector<Thread> _threads; // 线程数组
    };
}